import request from "@/utils/request";

const baseUri = "/mv1/api/wemch";

export interface WemchQuery extends PageQuery {
  page?: number;
  limit?: number;
  shop_title?: string;
}

export interface WemchDetail {
  id: number;
  title: number;
  status: number;
  cart_path: string;
  key_path: string;
}

export interface WemchForm {
  id?: number;
  title?: string;
  cart_path?: string;
  key_path?: string;
  shop_id?: string;
  status?: number;
}

export function wemchList(query: WemchQuery) {
  return request({
    url: baseUri + "/",
    method: "get",
    params: query,
  });
}

export function getWemchOptions(query: WemchQuery) {
  return request({
    url: baseUri + "/options",
    method: "get",
  });
}

export function wemchDetail(id: number) {
  return request({
    url: baseUri + "/detail/" + id,
    method: "get",
    // params: {id},
  });
}

export function createWemch(data: WemchForm) {
  return request({
    url: baseUri + "/edit",
    method: "post",
    data: data,
  });
}

export function updateWemch(id: number, data: WemchForm) {
  return request({
    url: baseUri + "/edit/" + id,
    method: "put",
    data: data,
  });
}

export function deleteWemch(id: number) {
  return request({
    url: baseUri + "/" + id,
    method: "delete",
  });
}
